//
//  UIView+DDAlert.m
//  GSDacheDriver
//
//  Created by guoshikeji_a on 2017/3/1.
//  Copyright © 2017年 tanyin. All rights reserved.
//

#import "UIView+DDAlert.h"

#define DDALERT_MID_TAG 8033
#define DDALERT_BOTTOM_TAG 8034

#import "DDView_Alert.h"

@implementation UIView (DDAlert)


- (void)showMidDDAlertWithString:(NSString *)alertString {
    UIView *alert = [self viewWithTag:DDALERT_MID_TAG];
    if (alert) {
        [alert removeFromSuperview];
    }
    //
    DDView_Alert *alertView = [[DDView_Alert alloc] initWithTitle:alertString];
    alertView.tag = DDALERT_MID_TAG;
    [self addSubview:alertView];
    [alertView showMid];
    
}


- (void)showBottomDDAlertWithString:(NSString *)alertString {
    UIView *alert = [self viewWithTag:DDALERT_BOTTOM_TAG];
    if (alert) {
        [alert removeFromSuperview];
    }
    //
    DDView_Alert *alertView = [[DDView_Alert alloc] initWithTitle:alertString];
    alertView.tag = DDALERT_BOTTOM_TAG;
    [self addSubview:alertView];
    [alertView showBottom];
}

@end
